package com.jic.member.impl.power;

import java.lang.Long;
import java.util.List;

import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.member.entity.power.MememberLoginStatus;
import com.jic.member.mapper.power.MememberLoginStatusMapper;
import com.jic.member.service.power.MememberLoginStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 会员登录状态记录表
 * @author : 
 * @email : 
 * @since : 2020-05-26 11:00:37
 * @version : v1.0.0
 */
@Service
public class MememberLoginStatusServiceImpl implements MememberLoginStatusService {

    @Autowired
    private MememberLoginStatusMapper mememberLoginStatusMapper;

    @Override
    public long insert(MememberLoginStatus mememberLoginStatus) {
        long flag = mememberLoginStatusMapper.insert(mememberLoginStatus);
        return flag;
    }

    @Override
    public long delete(Long id) {
        return mememberLoginStatusMapper.delete(id);
    }

    @Override
    public long update(MememberLoginStatus mememberLoginStatus) {
        return mememberLoginStatusMapper.update(mememberLoginStatus);
    }

    @Override
    public MememberLoginStatus queryByPrimaryKey(Long id){
        return mememberLoginStatusMapper.queryByPrimaryKey(id);
    }

    @Override
    public List<MememberLoginStatus> query(MememberLoginStatus mememberLoginStatus){
        return mememberLoginStatusMapper.query(mememberLoginStatus);
    }

    @Override
    public PageResult<MememberLoginStatus> queryPage(MememberLoginStatus mememberLoginStatus, Page pageQuery) {
        //计算下标
        int startIndex = (pageQuery.getStart() - 1) * pageQuery.getLimit();
        List<MememberLoginStatus> list = mememberLoginStatusMapper.queryPage(startIndex, pageQuery.getLimit(), mememberLoginStatus);
        long count = mememberLoginStatusMapper.queryPageCount(mememberLoginStatus);
        PageResult pageResult = new PageResult();
        pageResult.setRows(list);
        pageResult.setTotal(count);
        return pageResult;
    }
}